<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>prevent取消默认事件</title>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>

</head>

<body>
    <div id="app">
        <!--  <a> 默认是转到百度，prevent阻止默认事件 -->
        <a @click.prevent="handlClick()" :href="url">百度一下</a>
        <form action="" @submit.pervent="handlClick()">hello world</form>
        <button @click.pervent="handlClick">hellow</button>
        <hr>
        <div @click="log(1)" style="background-color: #0000ff; height: 100px;">
            <div @click="log(2)" style="background-color: #66f; height: 50px;">
                <div @click="log(3)" style="background-color: #ccf; height: 25px;">
                    <a @click.prevent='log(4)' :href="url">百度一下</a>
                </div>
            </div>
        </div>
    </div>
    <script>
        var app = new Vue({
            el: '#app',
            data: {
                url: 'http://baidu.com'
            },
            methods: {
                handlClick: function() {
                    console.log("不加载界面")
                },
                log: function(value) {
                    console.log(value);
                }
            }
        })
    </script>
</body>

</html>